package com.liangzhong.view.tips
{
	import com.common.utils.Reflection;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	
	import lz.controls.tips.ITip;

	/**
	 *基础tips 提示 
	 * @author lake
	 * 
	 */	
	public class BaseTips extends Sprite implements ITip
	{
		/**
		 * 文本
		 */		
		private var _text			:TextField;
		/**
		 * 背景
		 */		
		private var _bg			:MovieClip;
		
		public function BaseTips()
		{
			super();
			//bg
			_bg = Reflection.createInstance("com.liangzhong.ui.backGround");
			if(_bg)
			{
				this.addChild(_bg);
			}
			//text field
			_text = new TextField();
			_text.gridFitType = "pixel";
			_text.autoSize = TextFieldAutoSize.CENTER;
			_text.selectable = false;
			_text.multiline = true;
			_text.wordWrap = true;
			var tlformat :TextFormat = new TextFormat();
			tlformat.color = "0xFFEAC4";
			tlformat.font = "宋体";
			tlformat.size = 12;
			tlformat.align = TextFormatAlign.CENTER;
			_text.defaultTextFormat = tlformat;
			_text.x = 6;
			_text.y = 6;
			_text.width = 500;
			addChild(_text);
		}
		
		public function get data():Object
		{
			return null;
		}
		/**
		 *设置内容 
		 * @param value
		 * {tip:""}
		 */		
		public function set data(value:Object):void
		{
			_text.htmlText = value.tip + "";
			_text.width = _text.textWidth + 15;
			_text.height =  _text.textHeight + 20;
			_bg.width = _text.width + 8;
			_bg.height = _text.height + 15;
		}
		
		public function destroy():void
		{
		}
	}
}